﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Chefbook.DataObjects;
using System.Globalization;
using Chefbook.DataAccessLayer;

namespace Chefbook.UserActions
{
    public class AddRecipeToCategoryAction : UserActionBase
    {
        private Recipe recipe;
        private Category category;

        public AddRecipeToCategoryAction(Recipe recipeToAdd, Category categoryToAddTo)
        {
            recipe = recipeToAdd;
            category = categoryToAddTo;
        }

        public override void DoAction()
        {
            base.DoAction();
            category.AddRecipe(recipe);
        }

        public override void UndoAction()
        {
            base.UndoAction();
            category.RemoveRecipe(recipe);
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentUICulture, "Add Recipe '{0}' To Category '{1}'", recipe, category);
        }
    }
}
